package cn.kailangtu.dataspot.tasks;

import java.util.ArrayList;
import java.util.List;

import cn.kailangtu.commontools.APPSPUtils;

public class TaskManager {
    List<BaseTask> taskContainer = new ArrayList<>();
    private static TaskManager instance;
    public static TaskManager getInstance()
    {
        if(instance == null)
        {
            instance = new TaskManager();
        }

        return instance;
    }

    private TaskManager()
    {
        taskContainer.add(new PLCTask());
        taskContainer.add(new TemperatureTask());
        taskContainer.add(new DianNengTask());

    }

    public void openAllTask() {

        new Thread(new Runnable() {
            @Override
            public void run() {

            }
        }).start();

        for (int i = 0; i < taskContainer.size(); i++) {
            taskContainer.get(i).init();
        }

    }

    public void closeAllTask()
    {
        for(int i =0;i< taskContainer.size();i++)
        {
            taskContainer.get(i).close();
        }
    }
}
